#ifndef _LOGIC_H_
#define _LOGIC_H_
#include <vector>
#include <string>
#include "Schedule.h"
#include <ctime>
#include <sstream>

using namespace std;
#define FIRST_INVERTED_COMMAS 0
#define SECOND_INVERTED_COMMAS 1
#define ON 2
#define TO 3
#define AT 4

enum COMMAND{ADD,DELETE,UPDATE,DISPLAY,UNDO,ERROR};
enum DAY{SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY};
enum UPDATE_TYPE{EVENT,TIME,PLACE,PRIORITY,NIL,DAY};

struct UPDATE_BLOCK
{
	string u_term;
	string u_stime,u_etime;
	Schedule::LEVEL level;
	UPDATE_TYPE update_type;
};

class ProcessCommands
{
private:

	Schedule S;
	UPDATE_BLOCK U;

	vector<string> tokens;
	string event_term;

	

	time_t rawtime;
	struct tm * timeinfo;

	//private methods for generate add
	bool check_for_day(int pos);
	bool check_for_time(int pos_startT,int pos_to);
	bool check_for_place(int pos);
	bool check_for_priority(int pos);
	//////////////////////////////////

	UPDATE_TYPE get_update_type(int pos);

	void generate_event_term();
	int check_inverted_commas();

	void clear_tokens();
	void clear_schedule();
	void clear_event_term();
	void clear_update_block();

	string create_1h_end_time(string startTime);
	string process_day_to_date(string day);

public:

	ProcessCommands();

	//depends on the interaction of logic and storage.
	//need a storage class asap
	bool generate_add();
	bool generate_del();
	bool generate_update();
	bool generate_display();
	


	bool display();

	void clear_containers();

	void splitString(string in);

	UPDATE_BLOCK get_update_block();
	COMMAND getCommandType();
	Schedule get_add_schedule();
	string get_event_term();

	vector<string> get_tokens();
	

};





#endif